<script>
export default {
  globalData: {
    tencentCaptchaAppID: "194271233",
  },
};
</script>
<script setup>
import { onHide, onLaunch, onShow } from "@dcloudio/uni-app";
import { ossImage } from "@/utils/index";
onLaunch(async () => {
  //console.log("App Launch",import.meta.env);

  // #ifdef MP-WEIXIN

  const updateManager = uni.getUpdateManager();
  console.log(updateManager);
  updateManager.onCheckForUpdate(function (res) {
    // 请求完新版本信息的回调
    console.log(res.hasUpdate);
  });
  updateManager.onUpdateReady(function () {
    uni.showModal({
      title: "更新提示",
      content: "新版本已经准备好，是否重启应用？",
      success(res) {
        if (res.confirm) {
          // 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
          updateManager.applyUpdate();
        }
      },
    });
  });

  updateManager.onUpdateFailed(function () {
    // 新的版本下载失败
  });

  /*wx.openPrivacyContract({
    success: () => {}, // 打开成功
    fail: (r) => {console.log(r)}, // 打开失败
    complete: () => {}
  })*/
  wx.getPrivacySetting({
    success: (res: any) => {
      console.log(res); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
      if (res.needAuthorization) {
        // 需要弹出隐私协议
      } else {
      }
    },
    fail: () => {},
    complete: () => {},
  });

  // #endif
});
onShow(() => {
  uni.loadFontFace({
    global: true,
    family: "alimama",
    source: `url("${ossImage("style/AlimamaShuHeiTi-Bold.ttf")}")`,
    success() {
      console.log("success");
    },
  });
});
onHide(() => {
  console.log("App Hide");
});
</script>
<style lang="scss">
@import "./uni.scss";
@import "./static/styles/common.scss";
@import "./static/styles/base.scss";
@import "./uni_modules/vk-uview-ui/index.scss";
@import "./static/styles/iconfont.css";
</style>
